package entity

import tornadofx.*

class PbcEbookEntity(id: Int, name: String, path: String, is_dir: Boolean, content: String) {
    var id by property(id)
    fun idProperty() = getProperty(PbcEbookEntity::id)

    var name by property(name)
    fun nameProperty() = getProperty(PbcEbookEntity::name)

    var path by property(path)
    fun pathProperty() = getProperty(PbcEbookEntity::path)

    var is_dir by property(is_dir)
    fun is_dirProperty() = getProperty(PbcEbookEntity::is_dir)

    var content by property(content)
    fun contentProperty() = getProperty(PbcEbookEntity::content)


//    constructor(id: Int, name: String, path: String, is_dir: Boolean, content: String): this(HashMap()) {
//        this.id = id
//        this.name = name
//        this.path = path
//        this.is_dir = is_dir
//        this.content = content
//    }

    fun copy(id: Int = this.id, name: String = this.name, path: String = this.path, is_dir: Boolean = this.is_dir, content: String = this.content) = PbcEbookEntity(id, name, path, is_dir, content)

    override fun toString(): String {
        return "id=$id name=$name, path=$path, is_dir=$is_dir, content=$content"
    }
}

